package bdqn.t09.controller;

import bdqn.t09.service.AsLogsService;
import bdqn.t09.util.Pageinfo;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
public class LogsController {

    // 日志
    @Resource
    private AsLogsService logsService;

    @RequestMapping(value = "/log")
    public String toLog(){
        return "operationLog";
    }

    @RequestMapping(value = "/showAllLog")
    @ResponseBody
    public Object doShowLog(@RequestParam(defaultValue = "1") Integer page
                                ,@RequestParam(defaultValue = "10") Integer rows){
        Pageinfo pageinfo = logsService.selectAllLogs(page,rows);

        Map map = new HashMap();
        map.put("rows",pageinfo.getList());
        map.put("total",pageinfo.getCount());
        return map;
    }

}
